/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author niit
 */
@Entity
@Table(name = "fl_membergroup")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FlMembergroup.findAll", query = "SELECT f FROM FlMembergroup f"),
    @NamedQuery(name = "FlMembergroup.findByMemberid", query = "SELECT f FROM FlMembergroup f WHERE f.memberid = :memberid")})
public class FlMembergroup implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "memberid")
    private Integer memberid;
    @JoinColumn(name = "memberid", referencedColumnName = "memberid", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private FlMember flMember;
    @JoinColumn(name = "groupid", referencedColumnName = "groupid")
    @ManyToOne(optional = false)
    private FlGroups groupid;

    public FlMembergroup() {
    }

    public FlMembergroup(Integer memberid) {
        this.memberid = memberid;
    }

    public Integer getMemberid() {
        return memberid;
    }

    public void setMemberid(Integer memberid) {
        this.memberid = memberid;
    }

    public FlMember getFlMember() {
        return flMember;
    }

    public void setFlMember(FlMember flMember) {
        this.flMember = flMember;
    }

    public FlGroups getGroupid() {
        return groupid;
    }

    public void setGroupid(FlGroups groupid) {
        this.groupid = groupid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (memberid != null ? memberid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FlMembergroup)) {
            return false;
        }
        FlMembergroup other = (FlMembergroup) object;
        if ((this.memberid == null && other.memberid != null) || (this.memberid != null && !this.memberid.equals(other.memberid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.FlMembergroup[ memberid=" + memberid + " ]";
    }
    
}
